package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.internetofthings.firefightingiot;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot.IPSoundColumnService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @author Yang
 * LED控制器
 */
@Action
@RequestMapping("fireFightingIOT/iPSound")
public class IPSoundColumnController extends BaseController {
    @Resource
    public IPSoundColumnService ipSoundColumnService;


    /**
     * @Author YangYu
     * @Description 发布或播放列表
     * @Date Created in 15:13 2021/9/17
     * @Param [jsonParam]
     */
    @At(value = "publishOrPlayList", method = RequestMethod.GET)
    public RespEntity publishOrPlayList(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.publishOrPlayList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 上传文件到NAS(发布)
     * @Date Created in 15:13 2021/9/17
     * @Param [jsonParam]
     */
    @At(value = "uploadMediaFile", method = RequestMethod.POST)
    public RespEntity uploadMediaFile(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.uploadMediaFile(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 请求编辑执行任务
     * @Date Created in 15:13 2021/9/17
     * @Param [jsonParam]
     */
    @At(value = "publishAudio", method = RequestMethod.POST)
    public RespEntity publishAudio(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.publishAudio(jsonParam);
    }

    /**
     * 终止播放
     * @param jsonParam
     * @return
     */
    @At(value = "endPlay", method = RequestMethod.POST)
    public RespEntity endPlay(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.endPlay(jsonParam);
    }

    /**
     * 终止播放
     * @param jsonParam
     * @return
     */
    @At(value = "getTaskRunInfo", method = RequestMethod.GET)
    public RespEntity getTaskRunInfo(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.getTaskRunInfo(jsonParam);
    }

    /**
     * 删除文件（NAS 和 Windows）
     * @param jsonParam
     * @return
     */
    @At(value = "deleteMediaFile", method = RequestMethod.POST)
    public RespEntity deleteMediaFile(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.deleteMediaFile(jsonParam);
    }

    /**
     * 根据subId设置音量
     * @param jsonParam
     * @return
     */
    @At(value = "setTaskVolume", method = RequestMethod.POST)
    public RespEntity setTaskVolume(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.setTaskVolume(jsonParam);
    }

    /**
     * 获取设备音量，并显示设备音量
     * @param jsonParam
     * @return
     */
    @At(value = "showDeviceVolume", method = RequestMethod.POST)
    public RespEntity showDeviceVolume(@RequestBody(required = false) JSONObject jsonParam) {
        return ipSoundColumnService.showDeviceVolume(jsonParam);
    }
}
